package org.dtrd.modules.archive.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dtrd.modules.questionnaire.entity.bean.PatientBasicInfo;
import org.dtrd.modules.questionnaire.entity.bean.PatientDetailInfo;
import org.dtrd.modules.questionnaire.entity.bean.QuestionnaireRdVersionDetail;
import org.dtrd.modules.questionnaire.entity.bean.QuestionnaireLifewayDetail;

import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 * 体格检查
 * </p>
 *
 * @author QR
 * @since 2021-11-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dtrd_ent_rd_archive_physical")
public class DtrdEntRdArchivePhysical implements Serializable {


    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 患者ID
     */
    @TableField("patient_id")
    private Integer patientId;

    /**
     * 心率
     */
    @TableField("heart_rate")
    private Float heartRate;

    /**
     * 脉搏
     */
    @TableField("sphygmus")
    private Float sphygmus;

    /**
     * 呼吸
     */
    @TableField("breath")
    private Float breath;

    /**
     * 体温
     */
    @TableField("temperature")
    private Float temperature;

    /**
     * 体重
     */
    @TableField(value = "weight",updateStrategy = FieldStrategy.IGNORED)
    private Float weight;

    /**
     * 身高
     */
    @TableField(value = "height",updateStrategy = FieldStrategy.IGNORED)
    private Float height;

    /**
     * BMI
     */
    @TableField("bmi")
    private Float bmi;

    /**
     * 腰围
     */
    @TableField("waist")
    private Float waist;

    /**
     * 臀围
     */
    @TableField("hip")
    private Float hip;

    /**
     * 腰臀比
     */
    @TableField("whratio")
    private Float whratio;

    /**
     * 血压收缩压
     */
    @TableField("blood_systolic_press")
    private Float bloodSystolicPress;

    /**
     * 视力, 右眼视力
     */
    @TableField("vision")
    private String vision;

    /**
     * 右眼视力
     */
    @TableField("vision_right")
    private Float visionRight;

    /**
     * 皮肤检查
     */
    @TableField("skin_exam")
    private Integer skinExam;

    /**
     * 皮肤检查部位
     */
    @TableField("skin_part")
    private String skinPart;

    /**
     * 皮肤症状
     */
    @TableField("skin_symptom")
    private String skinSymptom;

    /**
     * 皮肤症状其他
     */
    @TableField("skin_symptom_other")
    private String skinSymptomOther;

    /**
     * 胰岛素注射部位
     */
    @TableField("insulin_injection")
    private Integer insulinInjection;

    /**
     * 胰岛素注射部位症状
     */
    @TableField("insulin_injection_symptom")
    private String insulinInjectionSymptom;

    /**
     * 胰岛素注射部位症状其他
     */
    @TableField("insulin_injection_symptom_other")
    private String insulinInjectionSymptomOther;

    /**
     * 微动脉瘤, 1-有,2-无
     */
    @TableField("eye_microaneurysm")
    private Integer eyeMicroaneurysm;

    /**
     * 视网膜内出血, 1-有(任一象极中<20), 2-有(任一象极中>=20),3-无
     */
    @TableField("eye_intraretinal_hemorrhage")
    private Integer eyeIntraretinalHemorrhage;

    /**
     * 棉絮斑, 1-有, 2-无
     */
    @TableField("eye_cotton_wool_spots")
    private Integer eyeCottonWoolSpots;

    /**
     * 眼底出血, 1-有, 2-无
     */
    @TableField("eye_fundus_bleeding")
    private Integer eyeFundusBleeding;

    /**
     * 硬性渗出, 1-有(非后极区),2-有(后极区),3-无
     */
    @TableField("eye_hard_exudation")
    private Integer eyeHardExudation;

    /**
     * 静脉串珠样改变, 1-有(<=两个象限),2-有(>两个象限),3-无
     */
    @TableField("eye_venous_beaded_changes")
    private Integer eyeVenousBeadedChanges;

    /**
     * 视网膜内微血管异常, 1-有(<=一个象限), 2-有(>一个象限), 3-无
     */
    @TableField("eye_microvascular_abnormalities_in_retina")
    private Integer eyeMicrovascularAbnormalitiesInRetina;

    /**
     * 后极部视网膜增厚, 1-有, 2-无
     */
    @TableField("eye_thickening_posterior_retina")
    private Integer eyeThickeningPosteriorRetina;

    /**
     * 玻璃体积血, 1-有, 2-无
     */
    @TableField("eye_vitreous_hemorrhage")
    private Integer eyeVitreousHemorrhage;

    /**
     * 新生血管形成, 1-有, 2-无
     */
    @TableField("eye_neovascularization")
    private Integer eyeNeovascularization;

    /**
     * 视网膜前出血, 1-有, 2-无
     */
    @TableField("eye_preretinal_hemorrhage")
    private Integer eyePreretinalHemorrhage;

    /**
     * 糖足检查, 1-异常, 2-无异常
     */
    @TableField("foot_sugar_foot_inspection")
    private Integer footSugarFootInspection;

    /**
     * 针刺痛觉, 1-正常, 2-缺失
     */
    @TableField("foot_acupuncture_pain")
    private Integer footAcupuncturePain;

    /**
     * 温度觉, 1-正常, 2-缺失
     */
    @TableField("foot_temperature_sense")
    private Integer footTemperatureSense;

    /**
     * 压力觉, 1-正常, 2-缺失
     */
    @TableField("foot_pressure_sense")
    private Integer footPressureSense;

    /**
     * 足背动脉触诊, 1-正常, 2-减弱, 3-缺失
     */
    @TableField("foot_palpation_of_dorsalis_pedis_artery")
    private Integer footPalpationOfDorsalisPedisArtery;

    /**
     * 踝反射, 1-正常, 2-减弱, 3-缺失, 4-亢进
     */
    @TableField("foot_ankle_reflex")
    private Integer footAnkleReflex;

    /**
     * 神经传导, 1-正常, 2-缺失
     */
    @TableField("foot_nerve_conduction")
    private Integer footNerveConduction;

    /**
     * 振动觉, 1-正常, 2-缺失
     */
    @TableField("foot_vibration_sense")
    private Integer footVibrationSense;

    /**
     * 间歇性跛行试验
     */
    @TableField("claudication_test")
    private Integer claudicationTest;

    /**
     * 颈动脉听诊
     */
    @TableField("carotid_auscultation")
    private Integer carotidAuscultation;

    /**
     * 股动脉听诊
     */
    @TableField("femoral_auscultation")
    private Integer femoralAuscultation;

    /**
     * 下肢皮肤温度测定
     */
    @TableField("legs_skin_temp")
    private Integer legsSkinTemp;

    /**
     * ABI
     */
    @TableField("abi")
    private Float abi;

    /**
     * ABI运动负荷试验
     */
    @TableField("abi_exercise_test")
    private Integer abiExerciseTest;

    /**
     * TBI
     */
    @TableField("tbi")
    private Integer tbi;

    /**
     * 经皮氧分压
     */
    @TableField("tcPO2")
    private Integer tcpo2;

    /**
     * 体格检查报告多图
     */
    @TableField("physical_photos_url")
    private String physicalPhotosUrl;

    /**
     * 血压舒张压
     */
    @TableField("blood_diastolic_press")
    private Float bloodDiastolicPress;

    /**
     * 是否服用降压药物
     */
    @TableField("if_hypotensor")
    private Integer ifHypotensor;

    /**
     * 神经传导功能检查
     */
    @TableField("nerve_conduction")
    private Integer nerveConduction;

    /**
     * 皮肤部位1
     */
    @TableField("skin_part1")
    private String skinPart1;

    /**
     * 皮肤症状1
     */
    @TableField("skin_symptom1")
    private String skinSymptom1;

    /**
     * 皮肤症状其他1
     */
    @TableField("skin_symptom_other1")
    private String skinSymptomOther1;

    /**
     * 胰岛素注射部位症状1
     */
    @TableField("insulin_injections_symptom1")
    private String insulinInjectionsSymptom1;

    /**
     * 胰岛素注射部位症状其他1
     */
    @TableField("insulin_injection_symptom_other1")
    private String insulinInjectionSymptomOther1;

    /**
     * 报告名称
     */
    @TableField("report_name")
    private String reportName;

    /**
     * 报告结论
     */
    @TableField("report_conclusion")
    private String reportConclusion;

    /**
     * 照片以 竖线 | 拼接
     */
    @TableField("photo")
    private String photo;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    /**
     * 基础检查是否确认完成, 1-是, 0-否
     */
    @TableField("basic_is_finished")
    private Integer basicIsFinished;

    /**
     * 眼底检查是否确认完成, 1-是, 0-否
     */
    @TableField("eye_is_finished")
    private Integer eyeIsFinished;

    /**
     * 皮肤检查是否确认完成, 1-是, 0-否
     */
    @TableField("skin_is_finished")
    private Integer skinIsFinished;

    /**
     * 糖足检查是否确认完成, 1-是, 0-否
     */
    @TableField("diabetic_foot_is_finished")
    private Integer diabeticFootIsFinished;

    /**
     * 其他是否确认完成, 1-是, 0-否
     */
    @TableField("other_is_finished")
    private Integer otherIsFinished;


    /**
     * 基础检查报告名称
     */
    @TableField("basic_report_name")
    private String basicReportName;

    /**
     * 基础检查报告结论
     */
    @TableField("basic_report_content")
    private String basicReportContent;

    /**
     * 基础检查报告
     */
    @TableField("basic_report_photo")
    private String basicReportPhoto;

    /**
     * 眼底检查报告名称
     */
    @TableField("eye_report_name")
    private String eyeReportName;

    /**
     * 眼底检查报告结论
     */
    @TableField("eye_report_content")
    private String eyeReportContent;

    /**
     * 眼底检查报告
     */
    @TableField("eye_report_photo")
    private String eyeReportPhoto;

    /**
     * 皮肤检查报告名称
     */
    @TableField("skin_report_name")
    private String skinReportName;

    /**
     * 皮肤检查报告结论
     */
    @TableField("skin_report_content")
    private String skinReportContent;

    /**
     * 皮肤检查报告
     */
    @TableField("skin_report_photo")
    private String skinReportPhoto;

    /**
     * 糖足检查报告名称
     */
    @TableField("foot_report_name")
    private String footReportName;

    /**
     * 糖足检查报告结论
     */
    @TableField("foot_report_content")
    private String footReportContent;

    /**
     * 糖足检查报告
     */
    @TableField("foot_report_photo")
    private String footReportPhoto;

    /**
     * 其他检查报告名称
     */
    @TableField("other_report_name")
    private String otherReportName;

    /**
     * 其他检查报告结论
     */
    @TableField("other_report_content")
    private String otherReportContent;

    /**
     * 其他检查报告
     */
    @TableField("other_report_photo")
    private String otherReportPhoto;

    public DtrdEntRdArchivePhysical init() {
        isDel = 0;
        createTime = new Date();
        return this;
    }

    public DtrdEntRdArchivePhysical parseFromDTO(PatientDetailInfo dto) {
        patientId = dto.getPatientId();
        height = dto.getHeight();
        waist = dto.getWaistline();
        weight = dto.getWeight();
        return this;
    }

    public DtrdEntRdArchivePhysical parseFromDTO(QuestionnaireRdVersionDetail dto) {
        patientId = dto.getPatientId();
        height = dto.getHeight();
        waist = dto.getWaistline();
        weight = dto.getWeight();
        return this;
    }

    public DtrdEntRdArchivePhysical parseFromDTO(QuestionnaireLifewayDetail dto) {
        height = dto.getHeight();
        weight = dto.getWeight();
        return this;
    }

    public DtrdEntRdArchivePhysical parseFromDTO(PatientBasicInfo dto){
        patientId = dto.getPatientId();
        height = dto.getHeight();
        weight = dto.getWeight();
        if(height != null && weight != null){
            bmi = (float)Math.round((weight / (height * height) * 10000)*10)/10;
        }
        bloodDiastolicPress = dto.getBloodDiastolicPress();
        bloodSystolicPress = dto.getBloodSystolicPress();
        return this;
    }
}
